package day3.lesson08


class Person(var name:String){
  def sayHello= println("你好 我的名字叫"+name);
  def makeFriends(p:Person): Unit ={
    sayHello
    p.sayHello
  }
}

class Student(name:String) extends Person(name)

class Dog(var name:String)

class Worker(var name:String)

class Party[T <% Person](p1:Person,p2:Person){
  def play(): Unit ={
    //人跟人交朋友
    p1.makeFriends(p2)
  }
}

object Test {

  implicit def dog2person(dog:Dog):Person={
    new Person(dog.name)
  }

  def main(args: Array[String]): Unit = {
    val yunan = new Student("于男")
    val malaoshi = new Person("malaoshi")

    val els = new Person("二郎神")
    val dog = new Dog("哮天犬")


    new Party[Person](els,dog).play()

  }

}
